package com.campus.response;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class ResponseResult<T> {
    private Integer code;
    private String message;
    private T data;
    public ResponseResult(ResultCode resultCode,T data){
        this.code=resultCode.getCode();
        this.message=resultCode.getMessage();
        this.data=data;

    }
    public static <T>ResponseResult<T>  success(ResultCode resultCode,T data){
            return new ResponseResult<>(Code.SUCCESS_CODE,resultCode.getMessage(),data);
    }
}
